/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package idea.model.qnrlibrary;


import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;


/**
 *
 * @author rejun001
 */
@Entity
@Table( name = "data_elements" )
@XmlRootElement
@NamedQueries( 
{
    @NamedQuery( name = "DataElements.findAll" , query = "SELECT d FROM DataElements d" ) ,
    @NamedQuery( name = "DataElements.findByDeId" , query = "SELECT d FROM DataElements d WHERE d.deId = :deId" ) ,
    @NamedQuery( name = "DataElements.findByDeName" , query = "SELECT d FROM DataElements d WHERE d.deName = :deName" ) ,
    @NamedQuery( name = "DataElements.findByDeShortName" , query = "SELECT d FROM DataElements d WHERE d.deShortName = :deShortName" ) ,
    @NamedQuery( name = "DataElements.findByPaperStatus" , query = "SELECT d FROM DataElements d WHERE d.paperStatus = :paperStatus" ) ,
    @NamedQuery( name = "DataElements.findByDateCreated" , query = "SELECT d FROM DataElements d WHERE d.dateCreated = :dateCreated" ) ,
    @NamedQuery( name = "DataElements.findByCreatedBy" , query = "SELECT d FROM DataElements d WHERE d.createdBy = :createdBy" ) ,
    @NamedQuery( name = "DataElements.findByDateModified" , query = "SELECT d FROM DataElements d WHERE d.dateModified = :dateModified" ) ,
    @NamedQuery( name = "DataElements.findByModifiedBy" , query = "SELECT d FROM DataElements d WHERE d.modifiedBy = :modifiedBy" )
} )
public class DataElements implements Serializable
{
    private static final long serialVersionUID = 1L;
    @Id
    @Basic( optional = false )
    @Column( name = "de_id" )
    private String deId;
    @Basic( optional = false )
    @Column( name = "de_name" )
    private String deName;
    @Column( name = "de_short_name" )
    private String deShortName;
    @Basic( optional = false )
    @Column( name = "paper_status" )
    private String paperStatus;
    @Basic( optional = false )
    @Column( name = "date_created" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date dateCreated;
    @Basic( optional = false )
    @Column( name = "created_by" )
    private String createdBy;
    @Column( name = "date_modified" )
    @Temporal( TemporalType.TIMESTAMP )
    private Date dateModified;
    @Column( name = "modified_by" )
    private String modifiedBy;
    @OneToMany( cascade = CascadeType.ALL , mappedBy = "deId" )
    private Collection<DeAg> deAgCollection;


    public DataElements()
    {
    }


    public DataElements( String deId )
    {
        this.deId = deId;
    }


    public DataElements( String deId , String deName , String paperStatus , Date dateCreated , String createdBy )
    {
        this.deId = deId;
        this.deName = deName;
        this.paperStatus = paperStatus;
        this.dateCreated = dateCreated;
        this.createdBy = createdBy;
    }


    public String getDeId()
    {
        return deId;
    }


    public void setDeId( String deId )
    {
        this.deId = deId;
    }


    public String getDeName()
    {
        return deName;
    }


    public void setDeName( String deName )
    {
        this.deName = deName;
    }


    public String getDeShortName()
    {
        return deShortName;
    }


    public void setDeShortName( String deShortName )
    {
        this.deShortName = deShortName;
    }


    public String getPaperStatus()
    {
        return paperStatus;
    }


    public void setPaperStatus( String paperStatus )
    {
        this.paperStatus = paperStatus;
    }


    public Date getDateCreated()
    {
        return dateCreated;
    }


    public void setDateCreated( Date dateCreated )
    {
        this.dateCreated = dateCreated;
    }


    public String getCreatedBy()
    {
        return createdBy;
    }


    public void setCreatedBy( String createdBy )
    {
        this.createdBy = createdBy;
    }


    public Date getDateModified()
    {
        return dateModified;
    }


    public void setDateModified( Date dateModified )
    {
        this.dateModified = dateModified;
    }


    public String getModifiedBy()
    {
        return modifiedBy;
    }


    public void setModifiedBy( String modifiedBy )
    {
        this.modifiedBy = modifiedBy;
    }


    @XmlTransient
    public Collection<DeAg> getDeAgCollection()
    {
        return deAgCollection;
    }


    public void setDeAgCollection( Collection<DeAg> deAgCollection )
    {
        this.deAgCollection = deAgCollection;
    }


    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += ( deId != null ? deId.hashCode() : 0 );
        return hash;
    }


    @Override
    public boolean equals( Object object )
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if ( !( object instanceof DataElements ) )
        {
            return false;
        }
        DataElements other = (DataElements) object;
        if ( ( this.deId == null && other.deId != null ) || ( this.deId != null && !this.deId.equals( other.deId ) ) )
        {
            return false;
        }
        return true;
    }


    @Override
    public String toString()
    {
        return "idea.model.qnrlibrary.DataElements[ deId=" + deId + " ]";
    }
    
}
